<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #box {
            width: 500px;
            height: 500px;
        }
    </style>
</head>
<body>
    <div id="box"></div>
    <script>
        const box = document.getElementById('box')
        function getRandomHexColor(){
           const r = 
           Math.floor(Math.random()*256);
            const g = 
           Math.floor(Math.random()*256);
            const b = 
           Math.floor(Math.random()*256);
           return `rgb(${r},${g},${b})`;
        }
        box.style.backgroundColor = getRandomHexColor()
    </script>
</body>
</html>